<?php
/**
 * 	app后台财务日志
 *  =============================
 * 	后台父类
 * 	=============================
 *	Author: 李宏宇
 *  Date: 2017-10-10
 * @author Administrator
 *
 */
namespace app\walletyhbbadmin\controller;
use Think\Db;
require_once (APP_PATH .'api/FinanceApi.php');
class Finance extends AdminBase
{
    //空操作
    public function _empty()
    {
        header("HTTP/1.0 404 Not Found");
        $this->display('Public:404');
    }

    /**
     * 商品列表
     */
    public function index()
    {
        $list = DB::name('Case_type')->select();
        foreach ($list as $k => $v) {
            $list[$k]['ct_jianjie'] = htmlspecialchars_decode($v['ct_jianjie']);
            $list[$k]['name'] = DB::name('Goods_category')->where('id', $v['ct_gid'])->value('name');
            $list[$k]['id'] = DB::name('Goods_category')->where('id', $v['ct_gid'])->value('parent_id');
        }
        foreach ($list as $kk => $vv) {
            $list[$kk]['pname'] = DB::name('Goods_category')->where('id', $vv['id'])->value('name');
        }
        $this->assign('list', $list);
        return $this->fetch('finance/index');
    }

    /**
     * 添加商品
     */
    public function add()
    {
        $arr = DB::name('Goods_category')->where('parent_id' . '!=' . '0')->select();
        $list = DB::name('Goods_category')->where('parent_id', '0')->select();
        $this->assign('list', $list);
        $this->assign('arr', $arr);
        return $this->fetch('finance/type');
    }

    public function xuanzeType()
    {
        $id = $_GET['parentId'];
        $list = DB::name('Goods_category')->where('parent_id', $id)->select();
        return json_encode($list);
    }

    public function doadd()
    {
        $data['ct_name'] = input('name');
        $arr['ct_name'] = input('uname');
        $list['ct_name'] = input('jname');

        $data['ct_fl'] = input('xuan');
        $arr['ct_fl'] = input('xuan');
        $list['ct_fl'] = input('xuan');

        $data['ct_jianjie'] = input('content');
        $arr['ct_jianjie'] = input('ucontent');
        $list['ct_jianjie'] = input('jcontent');

        $data['ct_gid'] = input('fenlei');
        $arr['ct_gid'] = input('fenlei');
        $list['ct_gid'] = input('fenlei');

        $data['time'] = time();
        $arr['time'] = time();
        $list['time'] = time();

        $data['status'] = input('status');
        $arr['status'] = input('status');
        $list['status'] = input('status');

        $file = request()->file('pic');
        if (!empty($file)) {
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
            $data['ct_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $arr['ct_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $list['ct_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
        } else {
            $this->error('请选择图片');
        }
        if ($data['ct_name'] == null || $arr['ct_name'] == null || $list['ct_name'] == null) {
            $this->error('请补全信息');
        }
        if ($data['ct_jianjie'] == null || $arr['ct_jianjie'] == null || $list['ct_jianjie'] == null) {
            $this->error('请补全信息');
        }
//         dump($data);die();
        $liid = DB::name('Case_type')->insertGetId($data);
        if ($liid) {
            $arr['id'] = $liid;
            $li1 = DB::name('Case_type_us')->insert($arr);
            $list['id'] = $liid;
            $li2 = DB::name('Case_type_jp')->insert($list);
            if ($li1 && $li2) {
                $this->success('添加成功', 'finance/index');
            }
        }
    }

    /**
     * 修改商品
     */
    public function edit()
    {
        $id = input('id');
        $res = DB::name('Case_type')->where('ct_id', $id)->find();
        $arr = DB::name('Case_type_us')->where('ct_id', $id)->find();
        $ar = DB::name('Case_type_jp')->where('ct_id', $id)->find();
        $res['fenleiming'] = DB::name('Goods_category')->where('id', $res['ct_gid'])->value('name');
        $res['fuleiid'] = DB::name('Goods_category')->where('id', $res['ct_gid'])->value('parent_id');
        $res['fuleiming'] = DB::name('Goods_category')->where('id', $res['fuleiid'])->value('name');
        $ll = DB::name('Goods_category')->where('id', $res['ct_gid'])->find();
        $list = DB::name('Goods_category')->where('parent_id', 0)->select();
        $this->assign('list', $list);
        $this->assign('res', $res);
        $this->assign('arr', $arr);
        $this->assign('ar', $ar);
        $this->assign('ll', $ll);
        return $this->fetch('finance/count');
    }


    public function doedit()
    {
        $id = input('id');
        $cha = DB::name('Case_type')->where('ct_id', $id)->find();
//        dump($cha);die();
        $data['ct_name'] = input('name');
        $arr['ct_name'] = input('uname');
        $list['ct_name'] = input('jname');

        $data['ct_fl'] = input('xuan');
        $arr['ct_fl'] = input('xuan');
        $list['ct_fl'] = input('xuan');

        $arr['ct_jianjie'] = input('ucontent');
        $list['ct_jianjie'] = input('jcontent');
        $data['ct_jianjie'] = input('content');

        $data['ct_gid'] = input('fenlei');
        $arr['ct_gid'] = input('fenlei');
        $list['ct_gid'] = input('fenlei');

//        $data['is_show'] = $cha['is_show'];
//        $arr['is_show'] = $cha['is_show'];
//        $list['is_show'] = $cha['is_show'];
        $file = request()->file('pic');
        if (!empty($file)) {
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
            $data['ct_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $arr['ct_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $list['ct_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
        } else {
            $data['ct_pic'] = $cha['ct_pic'];
            $arr['ct_pic'] = $cha['ct_pic'];
            $list['ct_pic'] = $cha['ct_pic'];
        }
        if ($data['ct_name'] == null || $arr['ct_name'] == null || $list['ct_name'] == null) {
            $this->error('请补全信息');
        }
        if ($data['ct_jianjie'] == null || $arr['ct_jianjie'] == null || $list['ct_jianjie'] == null) {
            $this->error('请补全信息');
        }
//        dump($list);die();
        $list3 = DB::name('Case_type')->where('ct_id', $id)->update($data);
        $list1 = DB::name('Case_type_us')->where('ct_id', $id)->update($arr);
        $list2 = DB::name('Case_type_jp')->where('ct_id', $id)->update($list);

            $this->success('修改成功', 'finance/index');

    }

    public function del()
    {
        $id = input('id');
        $res = DB::name('Case_type')->where('ct_id', $id)->delete();
        $res1 = DB::name('Case_type_us')->where('ct_id', $id)->delete();
        $res2 = DB::name('Case_type_jp')->where('ct_id', $id)->delete();
        if ($res && $res1 && $res2) {
            $this->success('删除成功', 'finance/index');
        }
    }

    /**
     * 产品分类
     */
    public function sort()
    {
        $list = DB::name('Goods_category')->where('parent_id', '0')->paginate(15, false, ['query' => input()]);
        $page = $list->render();
        $list = $list->all();
        $this->assign('page', $page);
        $this->assign('list', $list);
        return $this->fetch('finance/trans');
    }

    //添加分类
    public function addType()
    {
        if (IS_POST) {
            $data['name'] = input('name');
            $arr['name'] = input('uname');
            $list['name'] = input('jname');

//            $arr['c_title'] = input('name');
            $data['parent_id'] = 0;
            $arr['parent_id'] = 0;
            $list['parent_id'] = 0;

            $data['is_show'] = input('is_show');
            $arr['is_show'] = input('is_show');
            $list['is_show'] = input('is_show');

            if ($data['name'] == null || $data['is_show'] == null) {
                $this->error('请完善信息');
            }
            if ($arr['name'] == null || $arr['is_show'] == null) {
                $this->error('请完善信息');
            }
            if ($list['name'] == null || $list['is_show'] == null) {
                $this->error('请完善信息');
            }
            $resid = DB::name('Goods_category')->insertGetId($data);
            if ($resid) {
                $arr['id'] = $resid;
                $res1 = DB::name('Goods_category_us')->insert($arr);
                $list['id'] = $resid;
                $res2 = DB::name('Goods_category_jp')->insert($list);
                if ($res1 && $res2) {
                    $this->success('添加成功', 'finance/sort');
                } else {
                    $this->error('系统繁忙,请稍后再试');
                }
            }
        } else {
            return $this->fetch('finance/tixian');
        }
    }

    //删除分类
    public function delType()
    {
        $id = input('id');
        $count = DB::name('Goods_category')->where('parent_id', $id)->count();
        $countu = DB::name('Goods_category_us')->where('parent_id', $id)->count();
        $countj = DB::name('Goods_category_jp')->where('parent_id', $id)->count();
//        dump($count);die();
        if ($count > 0 || $countu > 0 || $countj > 0) {
            $this->error('该分类下有商品,不能删除');
        }
        $res = DB::name('Goods_category')->where('id', $id)->delete();
        $res1 = DB::name('Goods_category_us')->where('id', $id)->delete();
        $res2 = DB::name('Goods_category_jp')->where('id', $id)->delete();
        if ($res && $res1 && $res2) {
            $this->success('删除成功', 'finance/sort');
        }
    }

    //修改
    public function updateType()
    {
        if (IS_POST) {
            $where['id'] = input('id');
            $data['name'] = input('name');
            $arr['name'] = input('uname');
            $list['name'] = input('jname');
            $data['is_show'] = input('is_show');
            $arr['is_show'] = input('is_show');
            $list['is_show'] = input('is_show');
            if ($data['name'] == null || $data['is_show'] == null) {
                $this->error('请完善内容');
            }
            if ($arr['name'] == null || $arr['is_show'] == null) {
                $this->error('请完善内容');
            }
            if ($list['name'] == null || $list['is_show'] == null) {
                $this->error('请完善内容');
            }
            $res = DB::name('Goods_category')->where($where)->update($data);
            $res2 = DB::name('Goods_category_us')->where($where)->update($arr);
            $res3 = DB::name('Goods_category_jp')->where($where)->update($list);
            $this->success('修改成功', 'finance/sort');

        } else {
            $where['id'] = input('id');
            $info = DB::name('Goods_category')->where($where)->find();
            $info1 = DB::name('Goods_category_us')->where($where)->find();
            $info2 = DB::name('Goods_category_jp')->where($where)->find();
            $this->assign('info', $info);
            $this->assign('info1', $info1);
            $this->assign('info2', $info2);
            return $this->fetch('finance/bobi');
        }
    }

    public function updateStatus()
    {
        //获取id
        $where['id'] = input('id');
//        dump($id);
        //获取的状态值
        $status['is_show'] = input('status');
        $res = Db::name('Goods_category')->where($where)->update($status);
        $res1 = Db::name('Goods_category_us')->where($where)->update($status);
        $res2 = Db::name('Goods_category_jp')->where($where)->update($status);
        if ($res && $res1 && $res2) {
            $this->success('修改成功');
        } else {
            $this->error('系统繁忙,请稍后重试');
        }
    }

    public function updateStatus1()
    {
        //获取id
        $where['ct_id'] = input('id');
//        dump($id);
        //获取的状态值
        $status['status'] = input('status');
        $res = Db::name('Case_type')->where($where)->update($status);
        $res1 = Db::name('Case_type_us')->where($where)->update($status);
        $res2 = Db::name('Case_type_jp')->where($where)->update($status);
        if ($res && $res1 && $res2) {
            $this->success('修改成功');
        } else {
            $this->error('系统繁忙,请稍后重试');
        }
    }

    //查看二级分类
    public function showErji()
    {
        $where['parent_id'] = input('id');
        $erji = DB::name('Goods_category')->where($where)->select();
        $this->assign('list', $erji);
        $this->assign('parent_id', $where['parent_id']);
        return $this->fetch('finance/showerji');
    }

    //添加二级分类
    public function addErji()
    {
        if (IS_POST) {
            $data['name'] = input('name');
            $arr['name'] = input('uname');
            $list['name'] = input('jname');
            $data['is_show'] = input('is_show');
            $arr['is_show'] = input('is_show');
            $list['is_show'] = input('is_show');
            $data['parent_id'] = input('parent_id');
            $arr['parent_id'] = input('parent_id');
            $list['parent_id'] = input('parent_id');
            if ($data['name'] == null || $arr['name'] == null || $list['name'] == null) {
                $this->error('请完善信息');
            }
            $file = request()->file('image');
            if (!empty($file)) {
                $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
                $data['image'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
                $arr['image'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
                $list['image'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            } else {
                $this->error('请选择图片');
            }
            $resid = DB::name('Goods_category')->insertGetId($data);
            if ($resid) {
                $arr['id'] = $resid;
                $res1 = DB::name('Goods_category_us')->insert($arr);
                $list['id'] = $resid;
                $res2 = DB::name('Goods_category_jp')->insert($list);
                if ($res1 && $res2) {
                    $this->success('添加成功', 'finance/sort');
                } else {
                    $this->error('系统繁忙,请稍后再试');
                }
            }


        } else {
            $parent_id = input('parent_id');
            $this->assign('parent_id', $parent_id);
            return $this->fetch('finance/adderiji');
        }
    }

    //修改二级分类
    public function updateErji()
    {
        if (IS_POST) {
            $where['id'] = input('id');
            $li = DB::name('Goods_category')->where($where)->find();
//            dump($li['is_show']);
            $data['name'] = input('name');
            $arr['name'] = input('uname');
            $list['name'] = input('jname');
            $data['is_show'] = $li['is_show'];
            $arr['is_show'] = $li['is_show'];
            $list['is_show'] = $li['is_show'];
            $info = DB::name('Goods_category')->where($where)->find();
            if ($data['name'] == null || $arr['name'] == null || $list['name'] == null) {
                $this->error('请填写分类名');
            }
            $file = request()->file('image');
            if (!empty($file)) {
                $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
                $data['image'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
                $arr['image'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
                $list['image'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            } else {
                $data['image'] = $info['image'];
                $arr['image'] = $info['image'];
                $list['image'] = $info['image'];
            }
            $res = DB::name('Goods_category')->where($where)->update($data);
            $res1 = DB::name('Goods_category_us')->where($where)->update($arr);
            $res2 = DB::name('Goods_category_jp')->where($where)->update($list);
//            if ($res && $res1 && $res2) {
                $this->success('修改成功', 'finance/sort');
//            } else {
//                $this->error('未修改信息', 'finance/sort');
//            }


        } else {
            $where['id'] = input('id');
            $info = DB::name('Goods_category')->where($where)->find();
            $info1 = DB::name('Goods_category_us')->where($where)->find();
            $info2 = DB::name('Goods_category_jp')->where($where)->find();
            $this->assign('info', $info);
            $this->assign('info1', $info1);
            $this->assign('info2', $info2);
            return $this->fetch('finance/updateerji');
        }
    }

    /**
     * 产品详情
     */
    public function search()
    {
        $res = DB::name('Details')->select();
        $this->assign('res', $res);
        return $this->fetch('finance/search');
    }

//    添加
    public function addsearch()
    {
        return $this->fetch('finance/addsearch');
    }

    public function doaddsearch()
    {
        $data['p_p_type'] = input('p_p_type');
        $arr['p_p_type'] = input('p_p_type');
        $list['p_p_type'] = input('p_p_type');
        $data['p_cryogen'] = input('p_cryogen');
        $arr['p_cryogen'] = input('p_cryogen');
        $list['p_cryogen'] = input('p_cryogen');
        $data['p_application'] = input('p_application');
        $arr['p_application'] = input('p_application');
        $list['p_application'] = input('p_application');
        $data['p_form'] = input('p_form');
        $arr['p_form'] = input('p_uform');
        $list['p_form'] = input('p_jform');
        $data['p_cylinder'] = input('p_cylinder');
        $arr['p_cylinder'] = input('p_cylinder');
        $list['p_cylinder'] = input('p_cylinder');
        $data['p_c_mode'] = input('p_c_mode');
        $arr['p_c_mode'] = input('p_c_mode');
        $list['p_c_mode'] = input('p_c_mode');
        $data['p_displacement'] = input('p_displacement');
        $arr['p_displacement'] = input('p_displacement');
        $list['p_displacement'] = input('p_displacement');
        $data['p_model'] = input('p_model');
        $arr['p_model'] = input('p_model');
        $list['p_model'] = input('p_model');
        $data['p_w_ability'] = input('p_w_ability');
        $arr['p_w_ability'] = input('p_w_ability');
        $list['p_w_ability'] = input('p_w_ability');
        $data['p_b_ability'] = input('p_b_ability');
        $arr['p_b_ability'] = input('p_b_ability');
        $list['p_b_ability'] = input('p_b_ability');
        $data['p_w_power'] = input('p_w_power');
        $arr['p_w_power'] = input('p_w_power');
        $list['p_w_power'] = input('p_w_power');
        $data['p_cop'] = input('p_cop');
        $arr['p_cop'] = input('p_cop');
        $list['p_cop'] = input('p_cop');
        $data['p_condition'] = input('p_condition');
        $arr['p_condition'] = input('p_condition');
        $list['p_condition'] = input('p_condition');
        $data['p_name'] = input('p_name');
        $arr['p_name'] = input('p_name');
        $list['p_name'] = input('p_name');
        $file = request()->file('p_pic');
        if (!empty($file)) {
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
            $data['p_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $arr['p_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $list['p_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
        }
        $listid = DB::name('Details')->insertGetId($data);
        if ($listid) {
            $arr['id'] = $listid;
            $list1 = DB::name('Details_us')->insert($arr);
            $list['id'] = $listid;
            $list2 = DB::name('Details_jp')->insert($list);
            if ($list1 && $list2) {
                $this->success('添加成功', 'finance/search');
            } else {
                $this->error('系统繁忙,请稍后再试');
            }
        }
    }

//    修改
    public function editsearch()
    {
        $id = input('id');
        $res = DB::name('Details')->where('id', $id)->find();
        $res1 = DB::name('Details')->where('id', $id)->find();
        $res2 = DB::name('Details')->where('id', $id)->find();
        $this->assign('res', $res);
        $this->assign('res1', $res1);
        $this->assign('res2', $res2);
        return $this->fetch('finance/editsearch');
    }

    public function doeditsearch()
    {
        $id = input('id');
        $arrr = DB::name('Details')->where('id', $id)->find();
        $data['p_p_type'] = input('p_p_type');
        $arr['p_p_type'] = input('p_p_type');
        $list['p_p_type'] = input('p_p_type');
        $data['p_cryogen'] = input('p_cryogen');
        $arr['p_cryogen'] = input('p_cryogen');
        $list['p_cryogen'] = input('p_cryogen');
        $data['p_application'] = input('p_application');
        $arr['p_application'] = input('p_application');
        $list['p_application'] = input('p_application');
        $data['p_form'] = input('p_form');
        $arr['p_form'] = input('p_uform');
        $list['p_form'] = input('p_jform');
        $data['p_cylinder'] = input('p_cylinder');
        $arr['p_cylinder'] = input('p_cylinder');
        $list['p_cylinder'] = input('p_cylinder');
        $data['p_c_mode'] = input('p_c_mode');
        $arr['p_c_mode'] = input('p_c_mode');
        $list['p_c_mode'] = input('p_c_mode');
        $data['p_displacement'] = input('p_displacement');
        $arr['p_displacement'] = input('p_displacement');
        $list['p_displacement'] = input('p_displacement');
        $data['p_model'] = input('p_model');
        $arr['p_model'] = input('p_model');
        $list['p_model'] = input('p_model');
        $data['p_w_ability'] = input('p_w_ability');
        $arr['p_w_ability'] = input('p_w_ability');
        $list['p_w_ability'] = input('p_w_ability');
        $data['p_b_ability'] = input('p_b_ability');
        $arr['p_b_ability'] = input('p_b_ability');
        $list['p_b_ability'] = input('p_b_ability');
        $data['p_w_power'] = input('p_w_power');
        $arr['p_w_power'] = input('p_w_power');
        $list['p_w_power'] = input('p_w_power');
        $data['p_cop'] = input('p_cop');
        $arr['p_cop'] = input('p_cop');
        $list['p_cop'] = input('p_cop');
        $data['p_condition'] = input('p_condition');
        $arr['p_condition'] = input('p_condition');
        $list['p_condition'] = input('p_condition');
        $data['p_name'] = input('p_name');
        $arr['p_name'] = input('p_name');
        $list['p_name'] = input('p_name');
        $file = request()->file('p_pic');
        if (!empty($file)) {
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
            $data['p_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $arr['p_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
            $list['p_pic'] = '/public/uploads/' . str_replace('\\', '/', $info->getsaveName());
        } else {
            $data['p_pic'] = $arrr['p_pic'];
            $arr['p_pic'] = $arrr['p_pic'];
            $list['p_pic'] = $arrr['p_pic'];
        }
//        dump($data);die();
        $list = DB::name('Details')->where('id', $id)->update($data);
//        $list1 = DB::name('Details_us')->where('id', $id)->update($arr);
//        $list2 = DB::name('Details_jp')->where('id', $id)->update($list);
        if ($list) {
            $this->success('修改成功', 'finance/search');
        } else {
            $this->error('未修改信息', 'finance/search');
        }
    }

//    删除
    public function delsearch()
    {
        $id = $_POST['deid'];
        foreach($id as $k=>$v){
            $list = DB::name('Details')->where('id', $v)->delete();
        }
        if ($list) {
            $this->success('删除成功');
        } else {
            $this->error('系统繁忙,请稍后再试');
        }
    }

    //导入搜索数据
    public function uploadExecl()
    {
        header("content-type:text/html;charset=utf-8");
        $request = Request();
        $file = $request->file('file');
        if($file==null){
            $this->error('请选择文件');
        }
        $save_path = ROOT_PATH . 'uploads/';
        $info = $file->move($save_path);
        //print_r($info);exit;

        $filename=$save_path . DIRECTORY_SEPARATOR . $info->getSaveName();
        if(file_exists($filename)) {//如果文件存在
            vendor("PHPExcel.PHPExcel");


            if( strstr($filename,'.xlsx'))
            {
                vendor("PHPExcel.PHPExcel.Reader.Excel2007");
                $PHPReader = new \PHPExcel_Reader_Excel2007();
            }
            else
            {
                vendor("PHPExcel.PHPExcel.Reader.Excel5");
                $PHPReader = new \PHPExcel_Reader_Excel5();
            }

            //载入excel文件
            $PHPExcel = $PHPReader->load($filename);
            $sheet = $PHPExcel->getActiveSheet(0);//获得sheet
            $highestRow = $sheet->getHighestRow(); // 取得共有数据数
            $data=$sheet->toArray();
            unset($data[0]);
            foreach($data as $k=>$v){
                $arr['p_p_type']=$data[$k][0];
                $arr['p_cryogen']=$data[$k][1];
                $arr['p_application']=$data[$k][2];
                $arr['p_form']=$data[$k][3];
                $arr['p_cylinder']=$data[$k][4];
                $arr['p_c_mode']=$data[$k][5];
                $arr['p_displacement']=$data[$k][6];
                $arr['p_model']=$data[$k][7];
                $arr['p_w_ability']=$data[$k][8];
                $arr['p_b_ability']=$data[$k][9];
                $arr['p_w_power']=$data[$k][10];
                $arr['p_cop']=$data[$k][11];
                $arr['p_condition']=$data[$k][12];
                $arr['p_name']=$data[$k][13];
                $res=DB::name('Details')->insert($arr);
            }

                $this->success('导入成功');

        }else{
             $this->error('系统繁忙');
        }

    }
}